import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Login from '@/views/Login.vue'
// 这里如果使用{}包裹起Layout的话,会报错
import Layout from "@/views/layout/Layout.vue";
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Login',
    component: Login
  }, {
    path: '/layout',
    name: 'Layout',
    component: Layout,
    children: [
      {
        path: '/user',
        name: 'User',
        component: () => import('@/views/user/Index.vue')
      },
      {
        path: '/department',
        name: 'Department',
        component: () => import('@/views/department/Index.vue')
      }, {
        path: '/regiType',
        name: 'regiType',
        component: () => import('@/views/regiType/Index.vue')
      }, {
        path: '/disease',
        name: 'disease',
        component: () => import('@/views/disease/Index.vue')
      },
      {
        path: '/non_drug',
        name: 'non_drug',
        component: () => import('@/views/non_drug/Index.vue')
      }, {
        path: '/doctor_duty',
        name: 'doctor_duty',
        component: () => import('@/views/doctor_duty/Index.vue')
      },
      {
        path: '/registration',
        name: '/Registration',
        component: () => import('@/views/registration/Index.vue')
      },
      {
        path: '/fee',
        name: '/Fee',
        component: () => import('@/views/fee/Index.vue')
      },
      {
        path: '/refund',
        name: '/Refund',
        component: () => import('@/views/refund/Index.vue')
      },
      {
        path: '/removeDiag',
        name: '/RemoveDiag',
        component: () => import('@/views/removeDiag/Index.vue')
      }, {
        path: '/recordHome',
        name: '/recordHome',
        component: () => import('@/views/recordHome/Index.vue')
      },
      {
        path: '/inspection',
        name: '/Inspection',
        component: () => import('@/views/inspection/Index.vue')
      },
      {
        path: '/drugDisturb',
        name: '/DrugDisturb',
        component: () => import('@/views/drugDisturb/Index.vue')
      }
    ]
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
